package day4;

public class Demo8 {
    public static void main(String[] args) {
        int num[]={2,3,4,5,2,3,4,2,2,2,2};
        one:
        for(int i=0;i<num.length;i++){
            int count=0;
            for (int j=0;j<num.length-1;j++){
                if (num[i]==num[j]){
                    count++;
                }
            }
            if (count>=num.length/2) {
                System.out.println("元素"+num[i]+"出现了"+count+"次");
                break one;
            }
        }
    }
}

